///************************************************************************
/// <copyrigth>2018-2019 Corporation.All Rights Reserved</copyrigth>
/// <author>tangyingzhong</author>
/// <contact>tangyz114987@outlook.com</contact>
/// <version>v1.0.0</version>
/// <describe>
/// Module's common configuration 
///</describe>
/// <date>2019/7/25</date>
///***********************************************************************
#ifndef MODULECONFIG_H
#define MODULECONFIG_H

#define EXPORT_FUNCTION

// Export configuration
#ifdef EXPORT_FUNCTION

#define FUNC_ITEM extern "C" __declspec(dllexport)

#else 

#define FUNC_ITEM extern "C" __declspec(dllimport)

#endif

#ifdef EXPORT_CLASS

#define CLASS_ITEM  __declspec(dllexport)

#else 

#define CLASS_ITEM  __declspec(dllimport)

#endif

// Module function export configuration
#define REGISTER_CREATE_MODULE(BaseClassType,ClassType) \
FUNC_ITEM BaseClassType* CreateModule()\
{\
	return new ClassType();\
}

#define REGISTER_DESTORY_MODULE(BaseClassType) \
FUNC_ITEM void DestoryModule(BaseClassType* pModule) \
{\
	if (pModule != NULL) \
	{\
		delete pModule;\
		\
		pModule = NULL;\
	}\
}

#define REGISTER_MODULE(BaseClassType,ClassType) \
REGISTER_CREATE_MODULE(BaseClassType,ClassType); \
REGISTER_DESTORY_MODULE(BaseClassType);

#endif // MODULECONFIG_H
